<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>{:session('cp.cpsysname')}--系统管理平台</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="{:config('webconfig.description');}">
    <meta name="keywords" content="{:config('webconfig.keywords');}">
    <meta name="author" content="runoob">
    <link rel="stylesheet" href="__STATIC_URL__/static/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/index.css"/>
    <script src="__STATIC_URL__/static/js/jquery-2.1.4.min.js"></script>
    <script src="__STATIC_URL__/static/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="__STATIC_URL__/static/js/commen.js" type="text/javascript" charset="utf-8"></script>
    <script src="__STATIC_URL__/static/layer/layer.js"></script>
</head>
<style>
    .img-responsive {
        display: block;
        max-width: 100% !important;
        height: auto !important;
    }
    .adminex-form .col-sm-9{
        padding-right: 30px;
        padding-left: 0;
    }
</style>
<body>
{include file='public/header'/}
<section>
    <!------------------导航-------------------------->
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <div class="page-heading mgl15 mgr15">
            <ul class="breadcrumb">
                <li>当前位置是:</li>
                <li><a href="javascript:history.back();">代理管理</a></li>
                <li><a href="javascript:history.back();">代理列表</a></li>
                <li class="active" style="color: #02b87f;">代理详情</li>
            </ul>
        </div>
        <div class="mgl15 mgr15">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 style="margin:0;font-size:16px;color:#02b87f;">代理名称&nbsp;:&nbsp;<span>{$agentinfo.name}</span>
                    </h4>
                </div>
            </div>
            <ul id="myTab" class="nav nav-tabs">
                <li class="active">
                    <a class="fsz14" href="#Message" data-toggle="tab">基础信息</a>
                </li>
                <li class="dropdown">
                    <a class="fsz14" href="#open" data-toggle="tab">开放平台</a>
                </li>
            </ul>

            <div id="myTabContent" class="tab-content">

                <div class="tab-pane fade in active" id="Message">
                    <table class="table table-bordered">
                        <caption>基础信息</caption>
                        <tbody>
                        <tr>
                            <td class="active">代理名称</td>
                            <td>{$agentinfo.name}</td>

                        </tr>
                        <tr>

                            <td class="active">开户时间</td>
                            <td>{:date('Y-m-d H:i:s',$agentinfo['start_time'])}</td>
                            <td class="active">到期时间</td>
                            <td>{:date('Y-m-d H:i:s',$agentinfo['end_time'])}</td>


                        </tr>
                        </tbody>
                    </table>

                    <table class="table table-bordered">
                        <caption>详细信息</caption>
                        <tbody>
                        <tr>
                            <td class="active">民生商户号</td>
                            <td>{$agentinfo['cmmb_mch_id']}</td>
                            <td class="active">微信商户号</td>
                            <td>{$agentinfo['partnerid']}</td>
                            <td class="active">支付宝商户号</td>
                            <td>{$agentinfo['ali_app_id']}</td>
                        </tr>
                        <tr>
                            <td class="active">联系人</td>
                            <td>{$agentinfo['contacts']}</td>
                            <td class="active">联系方式</td>
                            <td>{$agentinfo['tel']}</td>
                            <td class="active">地址</td>
                            <td>{$agentinfo['address']}</td>
                        </tr>
                        </tbody>
                    </table>
                    {if condition="checkPath('mach/open_auth')"}
                    <table class="table table-bordered">
                        <caption>微信公众号授权</caption>
                        <tbody>
                        <tr>

                            <td class="active">授权情况</td>
                            <td>{if condition="$agentinfo['auth_type'] eq 0"}继承上级商户公众号{else /}自有公众号{/if}：<font color="green"> {$wxopen['gh_nick_name']}</font></td>

                            <td class="active">Appid</td>
                            <td>{$wxopen['authorizer_appid']}</td>

                            <td class="active">原始ID</td>
                            <td>{$wxopen['gh_id']}</td>
                        </tr>
                        <tr>
                            <td class="active">公众号认证信息</td>
                            <td>{:getwxlx($wxopen['verify_type_info'])}{:getwxrz($wxopen['service_type_info'])}</td>
                            <td class="active">认证主体</td>
                            <td>{$wxopen['principal_name']}</td>
                            <td class="active">授权时间</td>
                            <td>{:date('Y-m-d H:i:s',$wxopen['addtime'])}</td>
                        </tr>
                        <tr>
                            <td class="active">重新授权</td>
                            <td colspan="6"><a href="{:url('agents/open_auth')}?id={$agentinfo['id']}"><img style="width:100%;height:100%;" src="https://open.weixin.qq.com/zh_CN/htmledition/res/assets/res-design-download/icon_button3_1.png"/></a>
                            </td>
                        </tr>
                        </tbody>
                    </table>

                    <div class="alert alert-danger">授权公众号前请确认您的公众号为认证服务号，且已开通模版消息功能，子门店授权完成后不再继承母商户公众号</div>
                    {/if}
                </div>

                <div id="open" class="tab-pane fade" style="padding-top:15px;">

                    <table class="table table-bordered">
                        <caption>开放平台</caption>
                        <tbody>
                        <tr>

                            <td class="active">开放平台Appid</td>
                            <td>{$agentinfo['component_appid']}</td>

                        </tr>
                        <tr>
                            <td class="active">开放平台密钥</td>
                            <td>{$agentinfo['component_appsecret']}</td>

                        </tr>

                        <tr>
                            <td class="active">小程序请求信任域名</td>
                            <td>{$agentinfo['requestdomain']}</td>
                        </tr>
                        <tr>

                            <td class="active">小程序通信信任域名</td>
                            <td>{$agentinfo['wsrequestdomain']}</td>

                        </tr>
                        <tr>
                            <td class="active">小程序上传信任域名</td>
                            <td>{$agentinfo['uploaddomain']}</td>

                        </tr>
                        <tr>

                            <td class="active">小程序下载信任域名</td>
                            <td>{$agentinfo['downloaddomain']}</td>

                        </tr>
                        <tr>
                            <td class="active">小程序网关信任域名</td>
                            <td>{$agentinfo['webviewdomain']}</td>


                        </tr>


                        </tbody>
                    </table>

                    <table class="table table-bordered">
                        <caption>接入信息</caption>
                        <tbody>
                        <tr>
                            <td class="active">授权发起页域名</td>
                            <td>{$agentinfo['open_url']}</td>


                        </tr>
                        <tr>
                            <td class="active">授权事件接收URL</td>
                            <td>{$agentinfo['ticketurl']}</td>


                        </tr>
                        <tr>
                            <td class="active">消息与事件接收URL</td>
                            <td>{$agentinfo['msgurl']}</td>


                        </tr>
                        <tr>
                            <td class="active">消息加解密key</td>
                            <td>{$agentinfo['component_encodingaeskey']}</td>
                        </tr>
                        <tr>
                            <td class="active">消息校验Token</td>
                            <td>{$agentinfo['component_token']}</td>

                        </tr>
                        <tr>
                            <td class="active">公众号开发域名</td>
                            <td>{$agentinfo['open_url']}</td>


                        </tr>

                        <tr>
                            <td class="active">小程序服务器域名</td>
                            <td>{$agentinfo['open_url']}</td>


                        </tr>
                        <tr>
                            <td class="active">小程序业务域名</td>
                            <td>{$agentinfo['open_url']}</td>


                        </tr>
                        </tbody>
                    </table>

                </div>
            </div>
        </div>
        {include file='public/footer'/}
    </div>
</section>



</body>
<script type="text/javascript">
    <!--添加设备-->
    function addprint() {
        $.ajax({
            type: "POST",
            url: "{:url('mach/addprint')}",
            async: false,
            data: $('#frm').serialize(),
            success: function (data) {
                if(data.code==0){
                    layer.msg("添加成功",{icon:1});
                    $('#myModal2').modal('hide');
                    setTimeout("window.location.reload()",500);
                }else{
                    layer.alert(data.message);
                    return false;
                }
            }
        });
    }
    function adddeviceuser() {
        var mid = {$agentinfo['id']};
        var username = $('#myModalDevice #username').val();
        var password = $('#myModalDevice #password').val();
        var tk_password = $('#myModalDevice #tk_password').val();
        var xingming = $('#myModalDevice #xingming').val();
        if (xingming == '') {
            alert('姓名必填');
            return
        }
        if (username == '') {
            alert('登入账号必填');
            return
        }
        if (password == '') {
            alert('密码必填');
            return
        }
        $.ajax({
            type: 'post',
            url: "{:url('Mach/adddeviceuser')}",
            //dataType:"json",
            data: {
                merchid: mid,
                username: username,
                password: password,
                tk_password: tk_password,
                xingming: xingming,
            },
            success: function (data) {

                switch (data) {
                    case 0:
                        alert('添加成功');
                        window.location.reload();
                        break;
                    case 1:
                        alert('添加失败');
                        break;
                    case 2:
                        alert('用户已存在');
                        break;

                }


            }
        })
    }
    function deviceuser_modify(id, xingming, username) {
        $('#myModalDevice_md #id_md').val(id);
        $('#myModalDevice_md #xingming_md').val(xingming);
        $('#myModalDevice_md #username_md').val(username);

        $('#myModalDevice_md').modal('show');

    }
    function deviceuser_md() {
        var id = $('#myModalDevice_md #id_md').val();
        var password = $('#myModalDevice_md #password_md').val();
        var tk_password = $('#myModalDevice_md #tk_password_md').val();
        var xingming = $('#myModalDevice_md #xingming_md').val();
        if (xingming == '') {
            alert('姓名必填');
            return
        }
        $.ajax({
            type: 'post',
            url: "{:url('Mach/deviceuser_md')}",
            //dataType:"json",
            data: {
                id: id,
                password: password,
                tk_password: tk_password,
                xingming: xingming,
            },
            success: function (data) {

                switch (data) {
                    case 0:
                        alert('修改成功');
                        window.location.reload();
                        break;
                    case 1:
                        alert('修改失败');
                        break;
                    case 2:
                        alert('用户已存在');
                        break;

                }
            }
        })
    }
    $(function(){
        //        删除员工方法
        $(".cashierdel").click(function(event){
            event.stopPropagation();
            var id = $(this).attr("data-uid");
            //询问框
            layer.confirm('确认删除该员工吗？', {
                btn: ['确认','取消'] //按钮
            }, function(){
                $.ajax({
                    url:"{:url('personnel/cashierdel')}",
                    type:"post",
                    async:true,
                    data:{
                        id:id
                    },
                    success:function(data){
                        if(data.code==0){
                            layer.msg("删除成功",{time: 500,icon: 1});
                            setTimeout("window.location.reload()",500);
                            return false;
                        }else{
                            layer.alert(data.message,{icon:7});
                            return false;
                        }
                    }
                })
            }, function(){});
        });
        //        删除设备方法
        $(".printdel").click(function(event){
            event.stopPropagation();
            var id = $(this).attr("data-id");
            //询问框
            layer.confirm('确认删除该设备吗？', {
                btn: ['确认','取消'] //按钮
            }, function(){
                $.ajax({
                    url:"{:url('mach/delprint')}",
                    type:"post",
                    async:true,
                    data:{
                        id:id
                    },
                    success:function(data){
                        if(data.code==0){
                            layer.msg("删除成功",{time: 500,icon: 1});
                            setTimeout("window.location.reload()",500);
                            return false;
                        }else{
                            layer.alert(data.message,{icon:7});
                            return false;
                        }
                    }
                })
            }, function(){});
        });
    })
</script>

</html>